package my.edu.common.domain.purchase;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import my.edu.common.enumeration.OrderType;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ProductWithHighPrice {
    private OrderType orderType;
    private ArrayList<Detail> detailList;

    public void  add(Long productId, String productName, BigDecimal price, BigDecimal priceInRule){
        detailList.add(new Detail(productId, productName, price, priceInRule));
    }

    public List<Detail> getDetail(){
        return detailList;
    }

    public boolean isEmpty(){
        if (detailList==null || detailList.isEmpty())return true;
        else  return  false;
    }

    @Data
    @AllArgsConstructor
   private static class Detail{
        private Long productId;
        private String productName;
        private BigDecimal price;
        private BigDecimal priceInRule;
    }

}
